<?php
/**
 * Created by PhpStorm.
 * User: worry
 * Date: 2018/1/23
 * Time: 11:12
 */

namespace backend\controllers;


use common\services\UploadService;
use common\components\Error;
use common\controllers\BaseController;
use Yii;

class UploaderController extends BaseController
{
    /**
     * 上传文件信息保存
     * todo 功能未完成
     */
    public function actionSave()
    {
        Error::tryCatch(function(){
            $path = Yii::$app->request->post('path');
            $hash = Yii::$app->request->post('hash', '');
            if($path)  {
                Error::exception('path不能为空');
            }
            $data['path'] = $path;
            $data['hash'] = $hash;
            $service = new UploadService();
            $service->save($data);
        });
    }
}